This function enables a source list of to generate multiple lists of all the permutations of the list. Unlike the function permute, permute-unique generates multiple lists that in which the patterns of elements are consistently 'unique' with each other.
(permute-unique '(a a b b))
=> ((a a b b) (a b a b) (a b b a) (b a a b) (b a b a) (b b a a))
(permute '(a a b b))
=> ((a a b b) (a a b b) (a b a b) (a b b a) (a b a b) (a b b a)
(a a b b) (a a b b) (a b a b) (a b b a) (a b a b) (a b b a)
(b a a b) (b a b a) (b a a b) (b a b a) (b b a a) (b b a a)
(b a a b) (b a b a) (b a a b) (b a b a) (b b a a) (b b a a))